package com.zhongke.cotrun.service;

import com.github.pagehelper.PageInfo;
import com.zhongke.cotrun.model.exception.MyException;
import com.zhongke.cotrun.model.pojo.UserInfo;
import com.zhongke.cotrun.model.pojo.UserInforCompany;

import javax.servlet.http.HttpSession;
import java.util.Set;

public interface UserInfoService {
    /**
     * 用户注册
     *
     * @param userInfo
     * @return
     */
    public boolean useRegistration(UserInfo userInfo) throws MyException;

    /**
     * 企业注册
     *
     * @param userInfo
     * @return
     * @throws MyException
     */
    public boolean companyUseRegistration(UserInforCompany userInfo) throws MyException;

    /**
     * 用户登录
     *
     * @param phoneNumber
     * @param password
     * @return
     */
    public boolean userLogin(String phoneNumber, String code, String password, HttpSession session) throws MyException;

    /**
     * 修改用个人用户信息
     *
     * @param userInfo
     * @return
     */
    public boolean updateUserInfo(UserInfo userInfo, HttpSession session) throws MyException;

    /**
     * 修改企业用户基本信息
     *
     * @param userInfo
     * @return
     * @throws MyException
     */
    public boolean updateUserInfoForCompany(UserInforCompany userInfo) throws MyException;

    /**
     * 根据id查看用户
     *
     * @param userId
     * @return
     */
    public UserInfo selectUserInfoByid(Integer userId);

    /**
     * 根据id查看企业信息
     *
     * @param userId
     * @return
     */
    public UserInforCompany selectUserInfoCompanyById(Integer userId);

    /**
     * 校验密码
     */
    public boolean verifyPassword(String passwd, HttpSession session) throws MyException;

    /**
     * 校验手机号
     */
    public Boolean verifyPhoneNumber(String phoneNumber, HttpSession session) throws MyException;

    /**
     * 查询信息过滤掉敏感信息
     *
     * @param id
     * @return
     */
    public UserInforCompany selectUserInfoByIdFilter(Integer id);

    /**
     * 按条件检索所有的
     *
     * @param userInforCompany
     * @return
     */
    public PageInfo selectUserInfoAll(UserInforCompany userInforCompany, Integer pageNumber, Integer ageSize);

    /**
     * 修改审核状态
     */
    public Boolean upUserState(Set<Integer> userIds, Integer state);


    /**
     * 给用户增加身份
     * @param enditiy
     * @param userId
     * @return
     */
    public Boolean addUserEnditiy(String enditiy,Integer userId);

    /**
     * 按条件检索审核用户
     */
    PageInfo selectAuditUser(UserInfo userInfo,Integer pageNumber,Integer pageSize);

    int queryUnApprovalCounts();

    /**
     * 根据id和申请类型查询用户详情
     */
    <T> T selectAuditUserInfoById(Long id, Integer approvalType);

    /**
     * 审核通过
     * @param id
     * @param linkId
     * @param approvalType
     * @return
     */
    boolean approvalPass(Long id,Integer linkId, Integer approvalType);

    /**
     * 审核驳回
     * @param id
     * @param approvalType
     * @param auditOpinion
     * @return
     */
    boolean approvalReject(Long id, Integer approvalType, String auditOpinion);

}
